package com.wanmait.wanmarecruit.webController;

import com.wanmait.wanmarecruit.entity.*;
import com.wanmait.wanmarecruit.service.CityService;
import com.wanmait.wanmarecruit.service.DistrictService;
import com.wanmait.wanmarecruit.service.PositionTypeSecondService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("web")
public class WebPublishNewPositionController {

    @Resource
    private CityService cityService;
    @Resource
    private DistrictService districtService;
    @Resource
    private PositionTypeSecondService positionTypeSecondService;

    @RequestMapping("getPositionTypeSecondByPositionTypeId")
    @ResponseBody
    public List<PositionTypeSecond> getPositionTypeSecondByPositionTypeId(Integer positionTypeId){
        List<PositionTypeSecond> positionTypeSeconds = positionTypeSecondService.getPositionTypeSecondByPositionTypeId(positionTypeId);
        return positionTypeSeconds;
    }

    @RequestMapping("getDistrictByCity")
    @ResponseBody
    public List<District> getDistrictByCity(Integer cityId){
        List<District> districts = districtService.getDistrictByCity(cityId);
        return districts;
    }

    @RequestMapping("getCityByProvince")
    @ResponseBody
    public List<City> getCityByProvince(Integer provinceId){
        List<City> citys = cityService.getCityByProvince(provinceId);
        return citys;
    }
}
